import {Tag, TagProps} from "antd";
import React from "react";

export type ColorText = {
    text: string;
    color: TagProps["color"]
}

export type HTagProps = {
    value: any;
    mapping: { [key: string]: ColorText };
}
export const KnowTag = {
    text: "undefined",
    color: "default"
}

export default class HTag extends React.Component<HTagProps, any> {

    render() {
        const {text, color} = this.props.mapping[this.props.value] || KnowTag
        return <>
            <Tag color={color}>
                {text}
            </Tag>
        </>
    }
}